home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_baycom / ax25.doc < prev    next >
Text File  |  1996-06-25  |  17KB  |  426 lines

  1.         AX25 driver for BAYCOM-like modem.
  2.         Version of 4th of January 1992
  3.  
  4. Free license for this software is granted for _amateur_ use only.
  5. Commercial usage is prohibited.
  6.  
  7. AX25.COM is a packet driver comforming (to some extend) to well known
  8. "FTP packet driver specification". It's purpose is to serve as interface
  9. between application software (e.g. KA9Q NOS) and a modem connected
  10. to RS232 port (e.g. BAYCOM modem).
  11.  
  12. The driver relies on the following RS232 pins:
  13. RTS - controls PTT: high level activates the transmitter
  14. DTR - transmitted data. On this pin the driver sends data
  15.       to be transmitted by the modem.
  16.       When in receive state this pin is held high.
  17. CTS - received data. The modem should supply here the data it receives.
  18. DCD - the modem may supply here "carrier detect" signal.
  19.       This pin is _optional_ - it is not a must because the driver
  20.       is able to deliver carrier signal from received data.
  21. GND - a common ground for the above signals.
  22.  
  23. TxD outputs a signal which is in high (positive voltage)
  24. most of the time. A low power modem (TCM3105) can be supplied
  25. from RTS+DTR+TxD (adding realized with diodes).
  26.  
  27. My primary intention while writting this driver was to provide
  28. opportunity to run KA9Q NOS with simple modems based on TCM3105
  29. or AM7910 chip. I tested the driver _only_ with NOS - no other software
  30. was available at the time. Thus I can not guarantee full compatibility
  31. with "FTP packet driver" definition.
  32.  
  33. The driver status can be examined with PKSTAT.COM and the driver can be
  34. terminated (removed from memory) by TERMIN.COM. These two utilities
  35. are part of packet drivers package from Clarkson and they should work
  36. with any "FTP packet driver".
  37.  
  38. AX25 driver heavily relies on quick interrupt response.
  39. Thus the application software should avoid disabling
  40. CPU interrupts for long periods. Or say it in another words:
  41. enable interrupts whenever possible.
  42.  
  43. AX25.COM has several start-time options. To see them start it
  44. with "-?". If you start the driver without any command line
  45. switch it will use default values: COM1, 1200 baud, etc.
  46.  
  47. These are the options - default values are in []:
  48.  
  49. -b<bit rate> [1200] - decimal number
  50.     defines the bit rate. Rates below 300 are not accepted
  51.     because of PC's timer specific features.
  52.     Maximum usable rate is probably 2400 but it really depends
  53.     on your CPU... The upper limit for this parameter is 14400.
  54.     "Valid" rates are only numbers which can be expressed as 14400/n.
  55.     If you give an "invalid" value it will be adjusted to the closest
  56.     "valid" one.
  57.  
  58. -i<software interrupt> [60] - hexadecimal number
  59.     Tells the driver which software interrupt to use
  60.     for control functions. Usually you would use numbers
  61.     from 60..63 here because these are intended for user applications.
  62.  
  63. -B<COM port I/O base> [3f8] - hexadecimal number
  64.    I/O address of RS232 port: 3f8 for COM1, 2f8 for COM2
  65.  
  66. -I<COM port IRQ> [4] - hexadecimal number
  67.    Interrupt request line of RS232 port: 4 for COM1, 3 for COM2
  68.    Only the range 2..7 is supported so far. I'm not sure the irq 2
  69.    would work on a PC/AT.
  70.    After IRQ number you may add letter "p" (like: -I4p).
  71.    This will make the selected IRQ priority highest in the system.
  72.    This may help XT users to get the driver working
  73.    - the future will verify this.
  74.    Normally IRQ0 (system timer) has highest priority.
  75.  
  76. -s<slot time> [120] - decimal number 16..255
  77.    Slot time for p-persistance scheme. The value is in data bits.
  78.    For 1200 baud, slot time 120 bits means 100 ms.
  79.  
  80. -p<persistance> [64] - decimal number 0..255
  81.    p-persistance - the higher the value the higher the probability
  82.    of activating PTT at a time slot.
  83.  
  84.    Your station becomes more "agressive" on the air
  85.    with increasing persistance and decreasing slot time.
  86.  
  87. -h<tx header length> [240] - decimal number 8..65535
  88.    Number of extra bits the transmitter sends before actuall data
  89.    is transmitted. This is same as TxDelay on most TNCs.
  90.    240 bits means 200 ms at 1200 bps.
  91.  
  92.    You should always make this number as small as possible
  93.    for best bandwidth use. 240 tells you that many "useless"
  94.    bits (30 bytes) are being transmitted before real packet data goes out.
  95.  
  96.    Unlike most TNCs this driver sends a square wave not a series
  97.    of HDLC flags in front of a packet. This was easier to program
  98.    in software and it makes DPLL lock faster at receiving end.
  99.    Thus less header bits should be needed...
  100.    
  101. -t<tx tail length> [24] - decimal number 8..65535
  102.    Number of extra bits the transmitter sends _after_ the actuall data.
  103.    24 bits makes 20 ms tx tail.
  104.  
  105. -c<carrier sense mode> [t] - one of the following letters: f,c,t,d
  106.    mode      meaning           
  107.  
  108.     f      full duplex - transmit whenever data is pending.
  109.        This option disables carrier sensing.
  110.  
  111.     c      sense modem DCD line to find out whether channel is busy or not.
  112.        Your modem has to supply this signal. Note that TCM3105
  113.        does not do it very well... it sets DCD to high on any noise
  114.        on audio input. Am7910 is said to deliver much more reliable CD
  115.        signal.
  116.  
  117.     t      sense data transition - if incoming data signal moves
  118.        the driver assumes that the channel is busy - BAYCOM 1.5 uses
  119.        the same (or very similar) way with "CARRIER 1" switch.
  120.        Use this mode if you intend to use squelch in your radio.
  121.  
  122.     d      deliver "channel busy" status by analysing incoming data.
  123.        BAYCOM's v1.5 "CARRIER 0" does effectively similar thing although
  124.        it uses different algorithm. The driver examines the incoming
  125.        signals "regularity" - if data transitions comes at regular
  126.        intervals the channel is assumed busy.
  127.        With this mode you may run your radio with squelch open
  128.        all the time.
  129.        How this option works may depend on modem type. Some modems
  130.        have still very regular digital output signal even with white
  131.        noise applied to the analog input.
  132.  
  133. -T<DCD threshold> [50] decimal number 0..100
  134.     Threshold for software DCD (acts only when -cd option is selected)
  135.     The higher the number the "clearer" the signal must be to trigger
  136.     "channel busy" status. You should lower this number if your station
  137.     tends to transmit over others.
  138.  
  139. -S enable sound effects - when a valid frame is received you will
  140.    hear a short (1/18 sek) beep from PC's speaker.
  141.  
  142. Please note that argument line is case sensitive and so are hexadecimal
  143. values... "2F8" will not do - you must specify "2f8".
  144.  
  145.  
  146. Frequently asked questions with answers.
  147.  
  148. Q: How to start quickly ?
  149. A:
  150. 1. Start the ax25.com - most important parameters are COM base and irq.
  151.    an example for COM1: ax25 -B3f8 -I4
  152.    Now the driver takes control over the RS232 port and stays resident
  153.    waiting for NOS orders...
  154. 2. Start KA9Q NOS (you need the one supporting packet drivers)
  155.    and then type in:
  156.      ax25 mycall <your callsign>
  157.      attach packet 0x60 ax25 5 512
  158.      trace ax25 111
  159.    you should see packets being received now in trace window
  160.    In most NOS versions you press F9 to get there.
  161. 3. Try to connect to another station by typing:
  162.    connect ax25 <callsign>
  163. or split ax25 <callsign> (split window session in JNOS)
  164.  
  165. This setup in far from complete - it's just to see whether the driver
  166. cooperates with your hardware and it only allows you to work native AX.25
  167. Refer to NOS manuals/docs/guides for setting up a complete TCP/IP station.
  168.  
  169.  
  170. Q: I use -cd option (software DCD) and my station transmits over others
  171.    - it looks like DCD status is always "free channel".
  172. A:
  173. Try to lower DCD threshold using -T option. Default value is 50.
  174.  
  175.  
  176. Q: Are there any programs the driver dislikes ?
  177. A:
  178. Yes, SP9AUV discovered a small and nice program saying "Good Morning"
  179. (in polish) disabled the driver completely on his PC. The reason is a mistery
  180. as the program is not even resident.
  181. If the driver does not work, try to start the DOS from a diskette with
  182. simplest possible config.sys and autoexec.bat and give the driver
  183. another try.
  184.  
  185.  
  186. Q: How to change ax25 driver parameters ?
  187. A:
  188. If you realized that you have started ax25.com with not the parameters
  189. you liked use termin.com to terminate the driver (e.g. termin 0x60)
  190. and start ax25.com again with another option set.
  191. At the moment there is no way to change the driver's parameters
  192. after the driver is loaded.
  193.  
  194.  
  195. Q: Can the ax25 driver be loaded into high RAM ?
  196. A:
  197. Yes, the driver can be loaded into UMB to save base memory.
  198. However on my 386 when I tried to get UMB using EMM386.EXE
  199. the driver performance become worse even when loaded into low RAM.
  200. After trying UMBDR521 I got more UMB space (!?) and the driver
  201. could run both in low and high RAM without any side effects.
  202.  
  203.  
  204. Q: Can the driver work on an XT ?
  205.    or better: Why the driver does not work on my XT ?!
  206. A:
  207. I can't see any reason why not (appart from CPU speed)
  208. but haven't got a single report about the driver working on an XT.
  209. In contrary I'm getting lot of claims that "BAYCOM works
  210. but the ax25 driver does not". I don't understand why...
  211.  
  212. Suggested solution are:
  213. 1. Try to specify "p" option after -I - this may help.
  214. 2. Take KA9Q NOS version from UCSD.EDU - it locks interrupts for
  215.    shorter amount of time when executing timer interrupt.
  216.  
  217. Q: How to check whether my PC is fast enough ?
  218. A:
  219. Do simple loopback by connecting DTR (data out) to CTS (data in).
  220. Then start the driver at 300 bps and -cf option (full duplex).
  221. Start the NOS, attach the packet driver (see "How to start quickly")
  222. and let NOS transmit few packets (for example by enabling beacon
  223. every 10 sek). Every packet sent should reapear as received in trace window.
  224. If so try higher speeds, if not either your PC is too slow or something else
  225. is wrong.
  226.  
  227.  
  228. Q: How big packets can ax25 driver handle ?
  229. A:
  230. The receiver can handle 2048 byte frames.
  231. This include address, control and data field but not CRC.
  232. The transmitter buffer can hold up to about 4KB.
  233. That is the amount of data which can be transmitted
  234. per each PTT push.
  235.  
  236.  
  237. Q: How to modify ax25.com buffer's sizes ?
  238. A:
  239. You may want to enlarge ax25.com buffers or make them smaller
  240. to save memory. Go into assembler source ax25.asm which should be included
  241. in this package - there is a comment about buffers around line 30.
  242.  
  243.  
  244. Q: How to compile ax25.asm to get ax25.com ?
  245. A:
  246. You type in two DOS commands:
  247.   tasm ax25
  248.   tlink /t ax25
  249.  
  250.  
  251. Q: How to connect my new modem to my RS232 port ?
  252. A:
  253. To cooperate with ax25 driver the modem should meet some
  254. minimal requirements. Basic roules are:
  255. 1. The modem must provide decoded received data on CTS pin.
  256. 2. The driver outputs data to be transmitted on DTR pin.
  257.    Modem should modulate and pass this signal to the radio.
  258. 3. Pin RTS controls the PTT of the radio. When it becomes positive
  259.    the radio (together with the modem) should go into transmition mode.
  260. 4. Optionally the modem may provide carrier detect signal
  261.    on DCD pin.
  262. 5. Don't forget about GND line which is the reference for all above signals
  263.  
  264. BAYCOM and many other modems build around TCM3105 or AM7910/11
  265. for use with BAYCOM or TFPCX software conform to this scheme.
  266.  
  267. If you are going to build your own modem you may encounter
  268. the problem of level conversion. RS232 ports of a PC
  269. use +/- 12 V while most modem chips need TTl levels (0..+5V).
  270. The most elegant solution is to use MAX232 or similar converter.
  271. A simpler (but not that elegant) way of doing conversion is to use
  272. CMOS inverters (I use 4049 with my TCM3105). Like on the picture below:
  273.  
  274.  
  275.         _____    |\
  276. RS232 DTR   ---|_____|---| \o_____ TTL modem TxD
  277.          50 or 100 k | /
  278.              |/
  279.  
  280.         _____     /|
  281. RS232 CTS   ---|_____|--o/ |_______ TTL modem RxD
  282.         0.5 k    \ |
  283.               \|
  284.  
  285.  
  286.         _____     /|     /|
  287. RS232 DCD   ---|_____|--o/ |___o/ |____ TTL modem DCD
  288.         0.5 k    \ |    \ |                      Modem Tx control
  289.               \|      \         ____+5V__      |
  290.                           |   _|_      |        Radio PTT
  291.                    Si diode  _|_  | | 3M   |          |
  292.                          /_\  |_|      |          |
  293.         _____    |\     _____  | |+   |    |  |\   |  ___ B |/  C
  294. RS232 RTS   ---|_____|---| \o--|_____|-| |----|----|--| \o---|___|--|
  295.          50 or 100 k | /    2.2 k  | |            | /    10 k   |\
  296.              |/            10 uF          |/              | E
  297.                                   -------
  298. RS232 GND ---o
  299.          |
  300.         _|______ 0V
  301.  
  302. Inverters are supplied from 0 and +5 Volts - same levels
  303. as modem TTL part. Note that there are no negative supplies anywhere.
  304.  
  305. The first scheme _does_ work because CMOS inputs accept voltages outside
  306. power supply range thanks to input protective diodes.
  307. The resistor limits the current flowing through these diodes.
  308. You _must_not_ avoid it !
  309.  
  310. The second scheme does work as well because the threshold between
  311. logical states in PC's RS232 is a bit above 0 Volts.
  312. BAYCOM team recomends HC or HCT series circuits - they must have
  313. a reason for it but I don't know what it is...
  314.  
  315. Please note that transmitted and received data polarity is not important
  316. in packet radio. Only transitions matters. BUT polarity of DCD signal
  317. DOES matter: positive means "channel is busy - another station transmiting"
  318. while negative means "channel is free - now we are allowed to transmit".
  319.  
  320. The last scheme shows PPT circuit with simple watchdog timer. It limits
  321. the transmition time and is recomended for unattended stations
  322. to protect against software failures.
  323.  
  324. It is a good practice to ground unused RS232 inputs (RI, DSR, DCD).
  325. Due to capacitive coupling to neighbour pins there may apear short spikes
  326. on them - these will trigger extra interrupts thus loading the CPU.
  327.  
  328. Another warning: I've seen BAYCOM modem schematics with a transistor
  329. driving CTS line. This solutions looks good because the
  330. transistor's collector is supplied with negative voltage delivered
  331. from TxD. But in practice I had nasty problems with such modems
  332. when a longer (1 meter) cable was being used... the receiver would
  333. not decode at all or it would receive only short frames.
  334.  
  335. The transistor drives CTS well but only when in saturation state.
  336. In open state CTS becomes very sensitive to any pickup - and the main
  337. source of pickup is TxD line - there is a square +/- 12V continues wave.
  338. If your cable is long and there is no shield between the wires
  339. this wave gets into CTS and makes decoding the true
  340. modem signal hard... The problem goes away with inverter drivers
  341. or short or shielded cable between modem and PC.
  342.  
  343. To find out if TxD really comes into CTS run BAYCOM,
  344. connect the modem (but no radio) and switch to CARRIER 1 mode
  345. (not needed for versions prior to 1.5). If you see RECV
  346. instead of QRV you got the problem...
  347.  
  348.  
  349.  
  350.  
  351. Have fun and _please_ send success/failure notes
  352. and comments/hints/complaints to:
  353.  
  354.     email:  jalocha@chopin.ifj.edu.pl
  355.     or      jalocha@vxcern.cern.ch
  356.     or      jalocha@dxcern.cern.ch
  357.     packet: SP9VRC@SP9ZDN.POL.EU (may not work from everywhere)
  358.  
  359. my home address:   Pawel Jalocha
  360.            Rynek Kleparski 14/7
  361.            PL-31150 KRAKOW (Poland)
  362.  
  363. Pawel, SR9VRC
  364.  
  365.  
  366.  History file
  367. ===============
  368.  
  369. First versions on 25-27 of April 1992: first approach to transmitter
  370. code caused inaccurate data transition timing. After fixing that bug
  371. another one got in: after transmiting 7KB of data the driver refuses
  372. to accept packets.
  373.  
  374.  
  375. 29 April 1992:
  376.  
  377. More-or-less stable version. Variables aligned to word boudary.
  378.  
  379.  
  380. 4 May 1992:
  381.  
  382. Defaults for tx head,tail and slot time are like most TNCs
  383.  
  384.  
  385. 6 May 1992:
  386.  
  387. Tx head, tail, slot time are printed out in bits and ms units.
  388.  
  389.  
  390. August 1992:
  391.  
  392. An attempt to cure problems occuring on COM ports handling
  393. IIR register not as I wished they did.
  394. By the way minor code review.
  395.  
  396.  
  397. November 1992:
  398.  
  399. There was a bug (just by mistyping) in version from August 1992
  400. - when COM interrupt found UART in do-not-need-service state
  401. it would not issue proper EOI. This could be responsible 
  402. for hangups not present in version of May.
  403.  
  404. -S option (sound effects) added. Every valid frame received
  405. makes a 1/18 sek beep.
  406.  
  407. "p" sub-option after -I added (makes IRQ priority higher)
  408.  
  409. High-lighting added to some messages. Uses ANSI codes so may cause
  410. a bit of disorder when ANSI.SYS is not loaded.
  411.  
  412.  
  413. January 1993
  414.  
  415. Use byte I/O instead of word I/O when writing baud rate into 8250 UART.
  416.  
  417. -T option - threshold for software DCD (option -cd)
  418.  
  419. -cd option improved to be insensitive for asymetry
  420. in modem's output (bad RXB for TCM3105).
  421.  
  422. Low pass filter DPLL for clock recovery replaced with random walk DPLL.
  423. I don't really know which is better... random walk DPLL seems
  424. to be a bit better... so I leave it in.
  425.  
  426.